package com.arron.algorithm.leetcodetop100.双指针;

/**
 * 移动数组中所有的0到末尾
 * 且不产生临时数组
 */
public class 移动0 {

    public void moveZeroes(int[] nums) {

        int j = 0;
        for (int i = 0; i < nums.length; i++) {
            if (nums[i] != 0){
                nums[j++] = nums[i];
            }
        }

        for (;j<nums.length;j++){
            nums[j] = 0;
        }


    }

}
